home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Enigma Amiga CD / Listati / 61-Febbraio-Esempio2.c < prev    next >
C/C++ Source or Header  |  1992-09-02  |  3KB  |  72 lines

  1. /*************************************************************************
  2. * Secondo programma esempio di Impariamo a programmare l'Amiga (4)       *
  3. * creato da Giuseppe Ligorio                                             *
  4. * scopo: dimostrazione di compatibilita' con versioni inferiori alla 2.0 *
  5. *        mediante OpenScreen e ExtNewScreen                              *
  6. *************************************************************************/
  7.  
  8. #define INTUI_V36_NAMES_ONLY
  9.  
  10. #include <exec/types.h>
  11. #include <intuition/intuition.h>
  12. #include <intuition/screens.h>
  13. #include <clib/exec_protos.h>
  14. #include <clib/dos_protos.h>
  15. #include <clib/intuition_protos.h>
  16.  
  17. /* puntatore alla base della librerie intuition.library */
  18. struct Library *IntuitionBase;
  19.  
  20.  
  21. void main()
  22. {
  23.   struct Screen *schermo;   /* puntatore allo schermo */
  24.   UWORD penne[] = { ~0 };   /* informazioni minime sulle penne per ottenere il look 3D */
  25.   char att[40];             /* stringa per l'attesa */
  26.  
  27.   struct TagItem schermo_tags[2];    /* lista dei tag per attributi dello schermo */
  28.  
  29.   struct ExtNewScreen nuovoschermo =     /* struttura con parametri dello schermo */
  30.   {
  31.     0,0,640,256,2,               /* LeftEdge,TopEdge,Width,Height,Depth */
  32.     0,1,                         /* DetailPen,BlockPen */
  33.     HIRES,                       /* ViewModes, alta risoluzione */
  34.     CUSTOMSCREEN|NS_EXTENDED,    /* Type, schermo custom, struttura estesa */
  35.     NULL,                        /* Font */
  36.     "Secondo schermo.",          /* Titolo */
  37.     NULL,                        /* Gadgets */
  38.     NULL,                        /* CustomBitMap */
  39.     NULL                         /* attributi per schermo 2.0, penne per look 3D */
  40.   };
  41.   
  42.   /* apertura intuition.library qualsiasi versione */
  43.   if ((IntuitionBase = OpenLibrary("intuition.library",0L)) == NULL)
  44.   {
  45.     printf("Errore, non posso aprire libreria\n");
  46.     exit(0);
  47.   }
  48.  
  49.   schermo_tags[0].ti_Tag = SA_Pens;
  50.   schermo_tags[0].ti_Data = (ULONG)penne;
  51.   schermo_tags[1].ti_Tag = TAG_DONE;
  52.  
  53.   nuovoschermo.Extension = schermo_tags;
  54.   
  55.   /* apertura schermo, se intuition.library e' inferiore alla 2.0 allora 
  56.      lo schermo sara' 640x256x2 senza look 3D, altrimenti avra' anche il
  57.      look tridimensionale grazie all'attributo SA_Pens */
  58.   if ((schermo = OpenScreen((struct NewScreen *)&nuovoschermo)) == NULL)
  59.   {
  60.     printf("Errore, non posso aprire lo schermo\n");
  61.     CloseLibrary(IntuitionBase);
  62.     exit(0);
  63.   }
  64.  
  65.   /* attesa inserimento stringa */
  66.   gets(att);
  67.  
  68.   /* chiusura schermo e libreria */
  69.   CloseScreen(schermo);
  70.   CloseLibrary(IntuitionBase);
  71. }
  72.